package ru.kipriz.todoly.api.entities;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>Copyright: Copyright (c) 2010</p>
 *
 * @author Andrey Volkov
 *         <br/>Date: 12/13/10
 */
public class ProjectObject implements Entity
{
    long id;
    String content;
    int childCount;
    int icon;
    int itemType;
    int parentId;
    boolean collapsed;
    int itemOrder;
    List<ProjectObject> children;
    boolean projectShared;
    String projectShareOwnerName;
    String ProjectShareOwnerEmail;

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    public int getChildCount()
    {
        return childCount;
    }

    public void setChildCount(int childCount)
    {
        this.childCount = childCount;
    }

    public int getItemsCount()
    {
        return childCount;
    }

    public void setItemsCount(int itemsCount)
    {
        this.childCount = itemsCount;
    }

    public int getIcon()
    {
        return icon;
    }

    public void setIcon(int icon)
    {
        this.icon = icon;
    }

    public int getItemType()
    {
        return itemType;
    }

    public void setItemType(int itemType)
    {
        this.itemType = itemType;
    }

    public int getParentId()
    {
        return parentId;
    }

    public void setParentId(int parentId)
    {
        this.parentId = parentId;
    }

    public boolean isCollapsed()
    {
        return collapsed;
    }

    public void setCollapsed(boolean collapsed)
    {
        this.collapsed = collapsed;
    }

    public int getItemOrder()
    {
        return itemOrder;
    }

    public void setItemOrder(int itemOrder)
    {
        this.itemOrder = itemOrder;
    }

    public List<ProjectObject> getChildren()
    {
        if (children == null)
        {
            children = new ArrayList<ProjectObject>();
        }
        return children;
    }

    public void setChildren(List<ProjectObject> children)
    {
        this.children = children;
    }

    public boolean isProjectShared() {
        return projectShared;
    }

    public void setProjectShared(boolean projectShared) {
        this.projectShared = projectShared;
    }

    public String getProjectShareOwnerName() {
        return projectShareOwnerName;
    }

    public void setProjectShareOwnerName(String projectShareOwnerName) {
        this.projectShareOwnerName = projectShareOwnerName;
    }

    public String getProjectShareOwnerEmail() {
        return ProjectShareOwnerEmail;
    }

    public void setProjectShareOwnerEmail(String projectShareOwnerEmail) {
        ProjectShareOwnerEmail = projectShareOwnerEmail;
    }

    @Override
    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (!(o instanceof ProjectObject))
        {
            return false;
        }

        ProjectObject that = (ProjectObject) o;

        if (childCount != that.childCount)
        {
            return false;
        }
        if (collapsed != that.collapsed)
        {
            return false;
        }
        if (icon != that.icon)
        {
            return false;
        }
        if (id != that.id)
        {
            return false;
        }
        if (itemOrder != that.itemOrder)
        {
            return false;
        }
        if (itemType != that.itemType)
        {
            return false;
        }
        if (parentId != that.parentId)
        {
            return false;
        }
        //todo
        /*if (children != null ? !children.equals(that.children) : that.children != null)
        {
            return false;
        }*/
        if (!content.equals(that.content))
        {
            return false;
        }

        return true;
    }
}
